from python.util import getCompId
import xlrd

vals = "('{0}', '{1}', '{2}', '{3}',  now())";
sql = ("INSERT INTO reim_project(comp_id, comp_name, project_name,  admin_staff, create_time) VALUES ");

workbook = xlrd.open_workbook(filename='./project.xls');
sheetNames = workbook.sheet_names();
sheet1 = workbook.sheet_by_index(0)

for r in range(1,sheet1.nrows):
    row = sheet1.row(r)
    comp = row[0].value
    projectName = row[1].value
    formatData = vals.format(getCompId(comp), comp, projectName, row[2].value, row[3].value)
    sql += formatData + ",\n"

print(sql[0:sql.find(',', -3)])

